package com.sky.com.sky.mapper;

import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     * **/

    //根据用户名查询数据库
    @Select("select * from employee where username=#{username}")
    Employee getByUsername(String username);

    // 根据手机号查询
    @Select("select * from employee where phone=#{phone}")
    Employee getByPhone(String phone);

    //根据身份证号去查询
    @Select("select * from employee where id_number=#{idNumber}")
    Employee getIdNumber(String idNumber);


    void insert(Employee employee);

    List<Employee> listLikeName(String name);

    //根据id查询
    @Select("select * from employee where id = #{id}")
    Employee getById(Long id);

    //修改员工
    void update(Employee employee);

    //条件查询
    List<Employee> getList(String name);

    @Update("update employee set status=#{status} where id=#{id}")
    void updateById(Employee employee);


}
